try {
  const timeline = this.pageObj.getApiWidgetByAliasName('timeline-v2');
  const timelineDetail = this.pageObj.getApiWidgetByAliasName('timeline-detail');
  const eventReturn = this.pageObj.getApiWidgetByAliasName('event-return');
  const judgeForm = this.pageObj.getApiWidgetByAliasName('judge-content').widgetObj
  const id = judgeForm._option.dataSource.id || ''

  let option = timeline.widgetObj._option;
  let subOpt = timelineDetail.widgetObj._option;
  const com = { nowrap: true, type: "text" };
  const row = { column: 9, container: "content", nowrap: true, overflow: 'ellipsis', type: "object" };
  const { data, index } = $event;

  console.log($event, timeline, option);

  option.mode = 'card';
  option.bubble = { type: 'bubble-border', right: 15 };
  option.triangle = { direction: 'bottom', bottom: -25 };

  eventReturn.showWidget();

// 子列表
  subOpt.duration = 'vertical';
  subOpt.mode = 'timeline';

  function request(url, body = {}) {
    const opt = {
      method: 'POST',
      headers: {
        'Content-type': 'application/json;charset=UTF-8'
      },
      body: JSON.stringify({ pageNum: 1, pageSize: 100, ...body})
    }
    return fetch(url, opt)
      .then(res => res.json())
      .then(({ success, result }) => {
        if (success) {
          console.log('---------------------> ', result.result);
          return result.result
        }
      })
  }

  request('/Basics/basics-main/system/dictInfo/list').then(({ success, result }) => {
    if (success) {
      option.dataSource = result.result.map((item, index) => ({
        ...item,
        recordTitle: `测试-${index}`,
        recordTime: format(item.recordTime),
      }));

      this.widgetObj._option = option
      this.widgetObj.render()
    }
  })

  if ($event.type === '详情') {
    option.config = [
      { ...row, field: "eventName", label: "关联事件" },
      { ...row, field: "taskTitle", label: "任务名称" },
      { ...row, field: "receiveSystemName", label: "任务接受方" },
      { ...row, field: "taskTime", label: "任务时间" },
      { ...row, field: "taskTypeName", label: "任务类型" },
      { ...row, field: "taskSite", label: "任务点位" },
      { ...row, field: "taskIssuDepart", label: "任务下发部门" },
      { ...row, field: "taskIssuer", label: "任务下发人" },
      // { ...row, field: "files", label: "任务附件",  type: "file" },
      { ...row, field: "status", label: "任务状态" },
    ];
    option.dataSource = [
      {
        "event": "反恐防爆",
        "name": "开展应急处置工作",
        "receiver": "张国良",
        "recordTime": "2023-07-31 20:46 至 2023-07-31 22:30",
        "type": "应急处置",
        "address": "重铁东站广场",
        "department": "调度中心",
        "sender": "张思",
        "value": "这里是对应的值",
        "content": "这里是附件文档.docx",
        "state": "进行中",
        "files": [
          "https://img-blog.csdnimg.cn/5a26bb2e6eb74aa0ac42d44bef0f61c2.mp4",
          "https://img-blog.csdnimg.cn/5a26bb2e6eb74aa0ac42d44bef0f61c2.jpeg",
          "https://img-blog.csdnimg.cn/5a26bb2e6eb74aa0ac42d44bef0f61c2.xls"
        ]
      }
    ];

    // 子列表
    subOpt.bubble = { type: 'bubble-border' };
    subOpt.triangle = null;
    subOpt.node = { index: true };
    subOpt.config = [
      // 气泡内部的 第一行
      { ...com, column: 12, container: "content",  field: "taskDesc" },
    ];
  } else {
    option.config[option.config.length - 1] = { ...row, field: "value", label: "任务状态" };
    option.dataSource = [ data ];


    // 子列表
    subOpt.bubble = { type: 'bubble' };
    subOpt.triangle = { direction: 'left', left: -20 };
    subOpt.config = [
      // 气泡内部的 第一行
      { ...com, column: 12, container: "content",  field: "value" },
      // 气泡内部的 第二行
      { ...com, column: 6, container: "content",  field: "name", overflow: 'ellipsis' },
      // 气泡内部的 第二行
      { ...com, column: 6, container: "content",  field: "value", overflow: 'ellipsis' },
    ];
  }

  console.log(timeline.widgetObj._option, timeline.widgetObj.dataSource);
  timeline.widgetObj.show({ top: 220 });
  timeline.widgetObj._option = option;
  timeline.widgetObj.render();

  if ($event.type === '详情') {
    const $body = $(this.__box).find('.item-content .item-content-body');
    $body.css('height', '150px');
    $body.css('overflow', 'hidden auto');

  } else {
    const $body = $(this.__box).find('.item-content .item-content-body');
    $body.css('height', 'initial');
    $body.css('overflow', 'initial');
  }


  timelineDetail.widgetObj._option = subOpt;
  timelineDetail.widgetObj.show({ top: 400, height: 400 });
  timelineDetail.widgetObj.render();

} catch (e) {
  console.error(e)
}



